//
//  SWSViewController.m
//  SWS_Project01
//
//  Created by 马继鵬 on 17/3/7.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "SWSViewController.h"

@interface SWSViewController ()

@end

@implementation SWSViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupUI];
}
#pragma
#pragma-设置子控制器
- (void)setupUI
{
    NSMutableArray* arrayM = [NSMutableArray array];
    [arrayM addObject:[self navWithController:@"SWSHomeController" title:@"首页" image:nil]];
    [arrayM addObject:[self navWithController:@"SWSMineController" title:@"我的" image:nil]];
    
    self.viewControllers = arrayM;
}

- (UINavigationController*) navWithController:(NSString*)clsName title:(NSString*)title image:(NSString*)imageName
{
    Class CLS = NSClassFromString(clsName);
    
    UIViewController* controller = [[CLS alloc]init];
    
    UINavigationController* navController = [[UINavigationController alloc]initWithRootViewController:controller];
    //设置标题
    navController.title = title;
    navController.tabBarItem.image = [UIImage imageNamed:imageName];
    return navController;
    
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
